﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyThuVien.DataAccess;


namespace QuanLyThuVien.Business
{
    class SachBUS
    {
        SahDAL DSDAL = new SahDAL();
        public void ThemMaSach(Sach DS)
        {
           try
           {
                DSDAL.ThemMaSach(DS);
            }
            catch
            {
                MessageBox.Show("Mã này đã tồn tại.", "QuanLyThuVien");
            }
        }

        public void LoadLenDG(DataGridView dg)
        {
            DSDAL.LayDLlenDG(dg);
        }
        public string LoadMaDS(string maDS,string tenSach)
        {
            maDS = DSDAL.LoadMaDS(maDS,tenSach);
            return maDS;
        }

        public string LoadMaSach(string tenSach, string maSach)
        {
            maSach = DSDAL.LoadMaSach(tenSach, maSach);
            return maSach;
        }

        public void XoaMaSach(string maSach)
        {
                DSDAL.XoaMaSach(maSach);
        }

        public int LaySachCoMa(string maDS)
        {
            return DSDAL.LaySachCoMa(maDS);
        }

        public void LayMaSachLenCB(ComboBox cb, string MaDS)
        {
            DSDAL.LayMaSachLenCB(cb, MaDS);
        }
    }

}
